home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / AMScen_0_9.lha / AMScen / base.m next >
Text File  |  1995-01-21  |  36KB  |  1,268 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1995 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * base.m - standard MUD code for the basic activities and structures.
  9.  */
  10.  
  11. private tp_base CreateTable().
  12. use tp_base
  13.  
  14. public MAX_CARRY 7.
  15.  
  16. /* These properties are made public, so that a non-builder can make code
  17.    to use them in the playpen. These are special in that they are
  18.    referenced by the automatically generated code. We want that code to
  19.    compile properly, even if the builder hasn't @use'd any tables such
  20.    as t_base. */
  21.  
  22. public p_rName CreateStringProp().        /* the name of a room */
  23. public p_rContents CreateThingListProp().    /* the room's contents */
  24. public p_pCarrying CreateThingListProp().    /* player's inventory */
  25. public p_oName CreateStringProp().        /* encoded name of object */
  26. public p_oCarryer CreateThingProp().        /* who is carrying it */
  27. public p_oCreator CreateThingProp().        /* who "created" it */
  28. public p_oContents CreateThingListProp().    /* contents of an object */
  29.  
  30. /* some properties for rooms */
  31.  
  32. define t_base p_rBuyList CreateThingListProp(). /* list of things for sale */
  33. define t_base p_rNameAction CreateActionProp(). /* call proc instead */
  34. define t_base p_rDark CreateBoolProp().     /* its dark in here */
  35. define t_base p_rNoMachines CreateBoolProp().    /* keep the machines out */
  36. define t_base p_rLocked CreateBoolProp().    /* only owner can go in */
  37. define t_base p_rDesc CreateStringProp().    /* full description of room */
  38. define t_base p_rDescAction CreateActionProp(). /* call proc instead */
  39. define t_base p_rScenery CreateStringProp().    /* scenery names */
  40. define t_base p_rExits CreateIntListProp().    /* list of obvious exits */
  41. define t_base p_rFurtherDesc CreateActionProp()./* for any extra stuff */
  42. define t_base p_rLastVisit CreateIntProp().    /* useful for timing things */
  43. define t_base p_rNoGoString CreateStringProp(). /* print if cannot go */
  44. define t_base p_rNoGoAction CreateActionProp(). /* call if cannot go */
  45. define t_base p_rBuyAction CreateActionProp().    /* how to buy here */
  46.  
  47. /* the basic connections between rooms */
  48.  
  49. define t_base p_rNorth CreateThingProp().    /* actual north connection */
  50. define t_base p_rSouth CreateThingProp().
  51. define t_base p_rEast CreateThingProp().
  52. define t_base p_rWest CreateThingProp().
  53. define t_base p_rNorthEast CreateThingProp().
  54. define t_base p_rNorthWest CreateThingProp().
  55. define t_base p_rSouthEast CreateThingProp().
  56. define t_base p_rSouthWest CreateThingProp().
  57. define t_base p_rUp CreateThingProp().
  58. define t_base p_rDown CreateThingProp().
  59. define t_base p_rEnter CreateThingProp().
  60. define t_base p_rExit CreateThingProp().
  61.  
  62. define t_base p_rNorthDesc CreateStringProp().    /* special description */
  63. define t_base p_rSouthDesc CreateStringProp().
  64. define t_base p_rEastDesc CreateStringProp().
  65. define t_base p_rWestDesc CreateStringProp().
  66. define t_base p_rNorthEastDesc CreateStringProp().
  67. define t_base p_rNorthWestDesc CreateStringProp().
  68. define t_base p_rSouthEastDesc CreateStringProp().
  69. define t_base p_rSouthWestDesc CreateStringProp().
  70. define t_base p_rUpDesc CreateStringProp().
  71. define t_base p_rDownDesc CreateStringProp().
  72. define t_base p_rEnterDesc CreateStringProp().
  73. define t_base p_rExitDesc CreateStringProp().
  74.  
  75. define t_base p_rNorthMessage CreateStringProp(). /* to player when go */
  76. define t_base p_rSouthMessage CreateStringProp().
  77. define t_base p_rEastMessage CreateStringProp().
  78. define t_base p_rWestMessage CreateStringProp().
  79. define t_base p_rNorthEastMessage CreateStringProp().
  80. define t_base p_rNorthWestMessage CreateStringProp().
  81. define t_base p_rSouthEastMessage CreateStringProp().
  82. define t_base p_rSouthWestMessage CreateStringProp().
  83. define t_base p_rUpMessage CreateStringProp().
  84. define t_base p_rDownMessage CreateStringProp().
  85. define t_base p_rEnterMessage CreateStringProp().
  86. define t_base p_rExitMessage CreateStringProp().
  87.  
  88. define t_base p_rNorthOMessage CreateStringProp(). /* to others when go */
  89. define t_base p_rSouthOMessage CreateStringProp().
  90. define t_base p_rEastOMessage CreateStringProp().
  91. define t_base p_rWestOMessage CreateStringProp().
  92. define t_base p_rNorthEastOMessage CreateStringProp().
  93. define t_base p_rNorthWestOMessage CreateStringProp().
  94. define t_base p_rSouthEastOMessage CreateStringProp().
  95. define t_base p_rSouthWestOMessage CreateStringProp().
  96. define t_base p_rUpOMessage CreateStringProp().
  97. define t_base p_rDownOMessage CreateStringProp().
  98. define t_base p_rEnterOMessage CreateStringProp().
  99. define t_base p_rExitOMessage CreateStringProp().
  100.  
  101. define t_base p_rNorthEMessage CreateStringProp(). /* to others when enter */
  102. define t_base p_rSouthEMessage CreateStringProp().
  103. define t_base p_rEastEMessage CreateStringProp().
  104. define t_base p_rWestEMessage CreateStringProp().
  105. define t_base p_rNorthEastEMessage CreateStringProp().
  106. define t_base p_rNorthWestEMessage CreateStringProp().
  107. define t_base p_rSouthEastEMessage CreateStringProp().
  108. define t_base p_rSouthWestEMessage CreateStringProp().
  109. define t_base p_rUpEMessage CreateStringProp().
  110. define t_base p_rDownEMessage CreateStringProp().
  111. define t_base p_rEnterEMessage CreateStringProp().
  112. define t_base p_rExitEMessage CreateStringProp().
  113.  
  114. /* The various 'checker' lists are private, since they are accessed only
  115.    via the supplied Add/Del Checker routines. */
  116.  
  117. define tp_base p_rNorthChecks CreateActionListProp().
  118. define tp_base p_rSouthChecks CreateActionListProp().
  119. define tp_base p_rEastChecks CreateActionListProp().
  120. define tp_base p_rWestChecks CreateActionListProp().
  121. define tp_base p_rNorthEastChecks CreateActionListProp().
  122. define tp_base p_rNorthWestChecks CreateActionListProp().
  123. define tp_base p_rSouthEastChecks CreateActionListProp().
  124. define tp_base p_rSouthWestChecks CreateActionListProp().
  125. define tp_base p_rUpChecks CreateActionListProp().
  126. define tp_base p_rDownChecks CreateActionListProp().
  127. define tp_base p_rEnterChecks CreateActionListProp().
  128. define tp_base p_rExitChecks CreateActionListProp().
  129. define tp_base p_rAnyEnterChecks CreateActionListProp().
  130. define tp_base p_rAnyEnterActions CreateActionListProp().
  131. define tp_base p_rAnyLeaveChecks CreateActionListProp().
  132. define tp_base p_rAnyLeaveActions CreateActionListProp().
  133.  
  134. define tp_base p_rGetChecks CreateActionListProp().    /* passed the object */
  135. define tp_base p_rDropChecks CreateActionListProp().    /* passed the object */
  136.  
  137. define tp_base p_rSayChecks CreateActionListProp().    /* passed stuff said */
  138. define tp_base p_rLookChecks CreateActionListProp().    /* instead of/with */
  139.  
  140. /* some properties for players */
  141.  
  142. define t_base p_pDesc CreateStringProp().    /* the player's description */
  143. define t_base p_pDescCheck CreateActionProp().    /* check to see if look OK */
  144. define t_base p_pDescAction CreateActionProp(). /* call routine instead */
  145. define t_base p_pDescMore CreateActionListProp().    /* more desc stuff */
  146. define t_base p_pMoney CreateIntProp().     /* how much money player has */
  147. define t_base p_pVerbose CreateBoolProp().    /* player wants verbose desc */
  148. define t_base p_pSuperBrief CreateBoolProp().    /* player wants superbrief */
  149. define t_base p_pEchoPose CreateBoolProp().    /* echo pose, say to them */
  150. define t_base p_pHidden CreateBoolProp().    /* for special tricks */
  151. define t_base p_pStandard CreateBoolProp().    /* not on fight monsters */
  152. define t_base p_pPosition CreateIntProp().    /* special codes */
  153. define t_base p_pWhere CreateThingProp().    /* e.g. the bench */
  154. define t_base p_pCursor CreateIntListProp().    /* the chosen cursor */
  155. define t_base p_pCursorColour CreateIntProp().    /* what colour they want */
  156. define t_base p_pIconColour CreateIntProp().    /* what colour for these */
  157. define t_base p_pTextColours CreateIntListProp(). /* colours for text window */
  158. define t_base p_pPrivileged CreateBoolProp().
  159. define t_base p_pBuilder CreateBoolProp().    /* used in the 'build' code */
  160. define t_base p_pGivePre CreateActionProp().    /* before object check */
  161. define t_base p_pGivePost CreateActionProp().    /* after object check */
  162. define t_base p_pEnterActions CreateActionListProp().    /* do on startup */
  163. define t_base p_pHiddenList CreateThingListProp().  /* whatever is needed */
  164. define t_base p_pAliases CreateThingListProp(). /* top level aliases */
  165. define t_base p_sAliasKey CreateStringProp().    /* the alias key */
  166. define t_base p_sAliasValue CreateStringProp(). /* the aliased command */
  167. define t_base p_pFollowing CreateThingProp().    /* who I am following */
  168. define t_base p_pFollowers CreateThingListProp()./* those following me */
  169.  
  170. /* these are set by provided Add/Del routines, so can be private */
  171.  
  172. define tp_base p_pLeaveChecks CreateActionListProp().
  173. define tp_base p_pEnterChecks CreateActionListProp().
  174.  
  175. /* some properties for objects */
  176.  
  177. define t_base p_oDesc CreateStringProp().    /* long description of it */
  178. define t_base p_oDescCheck CreateActionProp().    /* check to see if look OK */
  179. define t_base p_oDescAction CreateActionProp(). /* call proc instead */
  180. define t_base p_oInvisible CreateBoolProp().    /* do not show up on look */
  181. define t_base p_oHome CreateThingProp().    /* its home location */
  182. define t_base p_oWhere CreateThingProp().    /* room it is now in */
  183. define t_base p_oLight CreateBoolProp().    /* also on players/machines */
  184. define t_base p_oReadString CreateStringProp(). /* stuff on a sign, etc. */
  185. define t_base p_oReadAction CreateActionProp().
  186. define t_base p_pReadChecker CreateActionProp()./* can he read? */
  187. define t_base p_oState CreateIntProp().     /* handy for lots of things */
  188. define t_base p_oCanSitIn CreateIntProp().    /* # + 1 who can sit in it */
  189. define t_base p_oCanSitOn CreateIntProp().    /* # + 1 who can sit on it */
  190. define t_base p_oCanLieIn CreateIntProp().    /* # + 1 who can lie in it */
  191. define t_base p_oCanLieOn CreateIntProp().    /* # + 1 who can lie on it */
  192. define t_base p_oCanStandIn CreateIntProp().    /* # + 1 who can stand in it */
  193. define t_base p_oCanStandOn CreateIntProp().    /* # + 1 who can stand on it */
  194. define t_base p_oPositionChecker CreateActionProp()./* checker for the above */
  195. define t_base p_oGiveChecker CreateActionProp()./* when try to give it */
  196. define t_base p_oPutMeInChecker CreateActionProp().
  197. define t_base p_oPutInMeChecker CreateActionProp().
  198. define t_base p_oTakeMeFromChecker CreateActionProp().
  199. define t_base p_oTakeFromMeChecker CreateActionProp().
  200. define t_base p_oFillMeWithChecker CreateActionProp().
  201. define t_base p_oFillWithMeChecker CreateActionProp().
  202. define t_base p_oUnlockMeWithChecker CreateActionProp().
  203. define t_base p_oUnlockWithMeChecker CreateActionProp().
  204. define t_base p_oNotLocked CreateBoolProp().
  205. define t_base p_oActWord CreateStringProp().    /* word to 'act' an object */
  206. define t_base p_oActString CreateStringProp().    /* simple string to print */
  207. define t_base p_oActAction CreateActionProp().    /* routine to call */
  208. define t_base p_oSpecialGrammar CreateGrammarProp(). /* for specials */
  209. define t_base p_oCapacity CreateIntProp().    /* number of contents */
  210. define t_base p_oConsumer CreateThingProp().    /* for potions */
  211.  
  212. define tp_misc POS_NONE 0.
  213. define tp_misc POS_SIT_IN 1.
  214. define tp_misc POS_SIT_ON 2.
  215. define tp_misc POS_LIE_IN 3.
  216. define tp_misc POS_LIE_ON 4.
  217. define tp_misc POS_STAND_IN 5.
  218. define tp_misc POS_STAND_ON 6.
  219.  
  220. define t_base p_oNotGettable CreateBoolProp().    /* stop people getting it */
  221. define t_base p_oGetChecker CreateActionProp(). /* passed the object */
  222. define t_base p_oDropChecker CreateActionProp()./* passed the object */
  223. define t_base p_oUnGetChecker CreateActionProp()./* passed the object */
  224. define t_base p_oBuyChecker CreateActionProp(). /* how to buy item */
  225. define t_base p_oPrice CreateIntProp().     /* price of it */
  226.  
  227. /* properties dealing with the simple graphics stuff */
  228.  
  229. define t_base p_rEnterRoomDraw CreateActionProp().
  230. define t_base p_rLeaveRoomDraw CreateActionProp().
  231. define t_base p_MapGroup CreateIntProp().
  232.  
  233. /* kind codes for effects */
  234.  
  235. define t_base EFFECT_SOUND    0.
  236. define t_base EFFECT_SPEECH    1.
  237. define t_base EFFECT_MUSIC    2.
  238.  
  239.  
  240. /*
  241.  * define a unique-id generator for sound-effects id's
  242.  */
  243.  
  244. define tp_base EffectIdBase CreateThing(nil).
  245. define tp_base eid_nextId CreateIntProp().
  246. EffectIdBase@eid_nextId := 0.
  247.  
  248. define t_base proc NextSoundEffectId()int:
  249.  
  250.     EffectIdBase@eid_nextId := EffectIdBase@eid_nextId + 1;
  251.     EffectIdBase@eid_nextId
  252. corp;
  253.  
  254.  
  255. /*
  256.  * define a time service for objects.
  257.  */
  258.  
  259. define tp_base TimeBase CreateThing(nil).
  260. define tp_base tb_first CreateThingProp().
  261. define tp_base tb_lastTime CreateIntProp().
  262. define tp_base tb_afterCount CreateIntProp().
  263.  
  264. define tp_base tl_next CreateThingProp().
  265. define tp_base tl_delay CreateIntProp().
  266. define tp_base tl_object CreateThingProp().
  267. define tp_base tl_action CreateActionProp().
  268.  
  269. TimeBase@tb_first := TimeBase.
  270. TimeBase@tb_lastTime := Time().
  271. TimeBase@tb_afterCount := 0.
  272.  
  273. CreateMachine("TimeKeeper", TimeBase, nil, nil).
  274.  
  275. define tp_base proc callUserCode(action a; thing object)void:
  276.  
  277.     SetEffectiveTo(Owner(object));
  278.     call(a, void)(object);
  279. corp;
  280.  
  281. define tp_base proc timerStep()void:
  282.     int last, now, delta;
  283.     thing tl, next;
  284.  
  285.     last := TimeBase@tb_lastTime;
  286.     if last ~= 0 then
  287.     /* do not trigger if shutting down */
  288.     TimeBase@tb_afterCount := TimeBase@tb_afterCount - 1;
  289.     now := Time();
  290.     delta := now - last;
  291.     tl := TimeBase@tb_first;
  292.     while tl ~= TimeBase do
  293.         tl@tl_delay := tl@tl_delay - delta;
  294.         tl := tl@tl_next;
  295.     od;
  296.     TimeBase@tb_lastTime := now;
  297.     while
  298.         tl := TimeBase@tb_first;
  299.         tl ~= TimeBase and tl@tl_delay <= 0
  300.     do
  301.         callUserCode(tl@tl_action, tl@tl_object);
  302.         TimeBase@tb_first := tl@tl_next;
  303.         ClearThing(tl);
  304.     od;
  305.     tl := TimeBase@tb_first;
  306.     if tl ~= TimeBase and TimeBase@tb_afterCount = 0 then
  307.         delta := tl@tl_delay;
  308.         TimeBase@tb_afterCount := TimeBase@tb_afterCount + 1;
  309.         After(delta, timerStep);
  310.     fi;
  311.     fi;
  312. corp;
  313.  
  314. define tp_base proc timerIdle()void:
  315.     int now, delta;
  316.     thing tl;
  317.  
  318.     now := Time();
  319.     delta := now - TimeBase@tb_lastTime;
  320.     tl := TimeBase@tb_first;
  321.     while tl ~= TimeBase do
  322.     tl@tl_delay := tl@tl_delay - delta;
  323.     tl := tl@tl_next;
  324.     od;
  325.     /* mark as going idle */
  326.     TimeBase@tb_lastTime := 0;
  327. corp;
  328.  
  329. ignore SetMachineIdle(TimeBase, timerIdle).
  330.  
  331. define tp_base proc timerActive()void:
  332.     thing tl;
  333.  
  334.     TimeBase@tb_lastTime := Time();
  335.     TimeBase@tb_afterCount := 0;
  336.     tl := TimeBase@tb_first;
  337.     if tl ~= TimeBase then
  338.     if tl@tl_delay <= 0 then
  339.         timerStep();
  340.     else
  341.         TimeBase@tb_afterCount := 1;
  342.         After(tl@tl_delay, timerStep);
  343.     fi;
  344.     fi;
  345. corp;
  346.  
  347. ignore SetMachineActive(TimeBase, timerActive).
  348.  
  349. define tp_base proc timerSet()status:
  350.  
  351.     TimeBase@tb_afterCount := TimeBase@tb_afterCount + 1;
  352.     After(TimeBase@tb_first@tl_delay, timerStep);
  353.     continue
  354. corp;
  355.  
  356. /*
  357.  * DoAfter - set things up so that after 'seconds' seconds, action 'a' will
  358.  *    be called with parameter 'object'. It will be called with the
  359.  *    EffectivePlayer set to the owner of 'object'.
  360.  *
  361.  *    Note that these time actions survive a server shutdown/restart - the
  362.  *    delay interval is considered to be seconds of server up-time. This
  363.  *    makes this facility ideal for timed events in scenario time.
  364.  */
  365.  
  366. define t_base proc DoAfter(int seconds; thing object; action a)void:
  367.     int now, delta;
  368.     thing tl, tlNew, next;
  369.  
  370.     if seconds < 0 then
  371.     Print("seconds < 0 in DoAfter\n");
  372.     elif object = nil then
  373.     Print("object = nil in DoAfter\n");
  374.     elif a = nil then
  375.     Print("action = nil in DoAfter\n");
  376.     else
  377.     now := Time();
  378.     delta := now - TimeBase@tb_lastTime;
  379.     tl := TimeBase@tb_first;
  380.     while tl ~= TimeBase do
  381.         tl@tl_delay := tl@tl_delay - delta;
  382.         tl := tl@tl_next;
  383.     od;
  384.     TimeBase@tb_lastTime := now;
  385.     tlNew := CreateThing(nil);
  386.     tlNew@tl_delay := seconds;
  387.     tlNew@tl_object := object;
  388.     tlNew@tl_action := a;
  389.     tl := TimeBase@tb_first;
  390.     if tl = TimeBase or seconds < tl@tl_delay then
  391.         tlNew@tl_next := tl;
  392.         TimeBase@tb_first := tlNew;
  393.         ignore ForceAction(TimeBase, timerSet);
  394.     else
  395.         while
  396.         next := tl@tl_next;
  397.         next ~= TimeBase and next@tl_delay <= seconds
  398.         do
  399.         tl := next;
  400.         od;
  401.         tlNew@tl_next := next;
  402.         tl@tl_next := tlNew;
  403.     fi;
  404.     fi;
  405. corp;
  406.  
  407. /*
  408.  * CancelDoAfter - attempt to cancel an action setup by DoAfter. Note that
  409.  *    DoAfter makes no checks for duplicates. This routine will simply
  410.  *    cancel the first event with the matching object/action that it finds.
  411.  *    In the current implementation, that is the earliest one to trigger.
  412.  *    Return 'false' if no matching event found, else return 'true'.
  413.  */
  414.  
  415. define t_base proc CancelDoAfter(thing object; action a)bool:
  416.     thing tl, next;
  417.  
  418.     tl := TimeBase@tb_first;
  419.     if tl = TimeBase then
  420.     false
  421.     elif tl@tl_object = object and tl@tl_action = a then
  422.     TimeBase@tb_first := tl@tl_next;
  423.     ClearThing(tl);
  424.     true
  425.     else
  426.     while
  427.         next := tl@tl_next;
  428.         next ~= TimeBase and
  429.         (next@tl_object ~= object or next@tl_action ~= a)
  430.     do
  431.         next := tl;
  432.         tl := tl@tl_next;
  433.     od;
  434.     if next = TimeBase then
  435.         false
  436.     else
  437.         tl@tl_next := next@tl_next;
  438.         ClearThing(next);
  439.         true
  440.     fi
  441.     fi
  442. corp;
  443.  
  444.  
  445. /* now some general utility routines */
  446.  
  447. /*
  448.  * InsertCommand - do a command, but display it first.
  449.  */
  450.  
  451. define t_base proc utility public InsertCommand(string command)void:
  452.  
  453.     Print(">>> " + command + "\n");
  454.     ignore Parse(G, command);
  455. corp;
  456.  
  457. /*
  458.  * DoChecks - run through an action list, calling each one. Assume they
  459.  *    all return a status value. Stop if one returns other than continue,
  460.  *    and return the overall result. This will be:
  461.  *        fail - a checker returned fail, i.e. do not proceed
  462.  *        succeed - a checker returned succeed, i.e. this check
  463.  *            overrode all others, but proceed with action
  464.  *        continue - nothing special - proceed with action
  465.  *    The distinction between the last two is only needed if the caller
  466.  *    would also do something similar to the checkers (see the use of
  467.  *    'DoRoomLookChecks' in 'EnterRoom' in 'util.m'.) Otherwise, most
  468.  *    callers will treat the value as yes/no.
  469.  *    Note: we assume that none of the actions modifies the list.
  470.  */
  471.  
  472. define t_base proc utility public DoChecks(list action la)status:
  473.     int count, i;
  474.     status st;
  475.  
  476.     st := continue;
  477.     if la ~= nil then
  478.     SetEffectiveToNone();
  479.     count := Count(la);
  480.     i := 0;
  481.     while i < count and st = continue do
  482.         st := call(la[i], status)();
  483.         i := i + 1;
  484.     od;
  485.     fi;
  486.     st
  487. corp;
  488.  
  489. /*
  490.  * DoThingChecks - same, except a thing is passed to each action.
  491.  */
  492.  
  493. define t_base proc utility public DoThingChecks(list action la;
  494.     thing th)status:
  495.     int count, i;
  496.     status st;
  497.  
  498.     st := continue;
  499.     if la ~= nil then
  500.     SetEffectiveToNone();
  501.     count := Count(la);
  502.     i := 0;
  503.     while i < count and st = continue do
  504.         st := call(la[i], status)(th);
  505.         i := i + 1;
  506.     od;
  507.     fi;
  508.     st
  509. corp;
  510.  
  511. /*
  512.  * DoStringChecks - same, except each checker is passed a string argument.
  513.  */
  514.  
  515. define t_base proc utility public DoStringChecks(list action la;
  516.     string s)status:
  517.     int count, i;
  518.     status st;
  519.  
  520.     st := continue;
  521.     if la ~= nil then
  522.     SetEffectiveToNone();
  523.     count := Count(la);
  524.     i := 0;
  525.     while i < count and st = continue do
  526.         st := call(la[i], status)(s);
  527.         i := i + 1;
  528.     od;
  529.     fi;
  530.     st
  531. corp;
  532.  
  533. /*
  534.  * DoIntChecks - same, except each checker is passed an int argument.
  535.  */
  536.  
  537. define t_base proc utility public DoIntChecks(list action la; int n)status:
  538.     int count, i;
  539.     status st;
  540.  
  541.     st := continue;
  542.     if la ~= nil then
  543.     SetEffectiveToNone();
  544.     count := Count(la);
  545.     i := 0;
  546.     while i < count and st = continue do
  547.         st := call(la[i], status)(n);
  548.         i := i + 1;
  549.     od;
  550.     fi;
  551.     st
  552. corp;
  553.  
  554. /*
  555.  * DoList - run through a list of actions, doing all of them.
  556.  *    Note: we assume that none of the actions modifies this list.
  557.  */
  558.  
  559. define t_base proc utility public DoList(list action la)void:
  560.     int i;
  561.  
  562.     if la ~= nil then
  563.     SetEffectiveToNone();
  564.     for i from 0 upto Count(la) - 1 do
  565.         call(la[i], void)();
  566.     od;
  567.     fi;
  568. corp;
  569.  
  570. /*
  571.  * DoThingActions - these are passed a thing, but return no result.
  572.  */
  573.  
  574. define t_base proc utility public DoThingActions(list action la; thing th)void:
  575.     int i;
  576.  
  577.     if la ~= nil then
  578.     SetEffectiveToNone();
  579.     for i from 0 upto Count(la) - 1 do
  580.         call(la[i], void)(th);
  581.     od;
  582.     fi;
  583. corp;
  584.  
  585. /*
  586.  * DoActionsString - do some actions, yielding a string.
  587.  */
  588.  
  589. define t_base proc utility public DoActionsString(list action la)string:
  590.     int i;
  591.     string s;
  592.  
  593.     s := "";
  594.     if la ~= nil then
  595.     SetEffectiveToNone();
  596.     for i from 0 upto Count(la) - 1 do
  597.         s := s + call(la[i], string)();
  598.     od;
  599.     fi;
  600.     s
  601. corp;
  602.  
  603. /*
  604.  * utility routines to yield direction properties, names, etc.
  605.  */
  606.  
  607. define t_base D_NORTH      0.
  608. define t_base D_NORTHEAST 1.
  609. define t_base D_EAST      2.
  610. define t_base D_SOUTHEAST 3.
  611. define t_base D_SOUTH      4.
  612. define t_base D_SOUTHWEST 5.
  613. define t_base D_WEST      6.
  614. define t_base D_NORTHWEST 7.
  615. define t_base D_UP      8.
  616. define t_base D_DOWN      9.
  617. define t_base D_ENTER     10.
  618. define t_base D_EXIT     11.
  619.  
  620. /*
  621.  * DirBack - return the 'reverse' direction for a given direction.
  622.  */
  623.  
  624. define t_base proc utility public DirBack(int dir)int:
  625.  
  626.     if dir < 4 then
  627.     dir + 4
  628.     elif dir < 8 then
  629.     dir - 4
  630.     else
  631.     dir >< 1
  632.     fi
  633. corp;
  634.  
  635. define t_base proc utility public DirName(int dir)string:
  636.     case dir
  637.     incase D_NORTH:
  638.     "the north"
  639.     incase D_NORTHEAST:
  640.     "the north-east"
  641.     incase D_EAST:
  642.     "the east"
  643.     incase D_SOUTHEAST:
  644.     "the south-east"
  645.     incase D_SOUTH:
  646.     "the south"
  647.     incase D_SOUTHWEST:
  648.     "the south-west"
  649.     incase D_WEST:
  650.     "the west"
  651.     incase D_NORTHWEST:
  652.     "the north-west"
  653.     incase D_UP:
  654.     "above"
  655.     incase D_DOWN:
  656.     "below"
  657.     incase D_ENTER:
  658.     "the inside"
  659.     incase D_EXIT:
  660.     "the outside"
  661.     default:
  662.     ""
  663.     esac
  664. corp;
  665.  
  666. define t_base proc utility public ExitName(int dir)string:
  667.     case dir
  668.     incase D_NORTH:
  669.     "north"
  670.     incase D_NORTHEAST:
  671.     "northeast"
  672.     incase D_EAST:
  673.     "east"
  674.     incase D_SOUTHEAST:
  675.     "southeast"
  676.     incase D_SOUTH:
  677.     "south"
  678.     incase D_SOUTHWEST:
  679.     "southwest"
  680.     incase D_WEST:
  681.     "west"
  682.     incase D_NORTHWEST:
  683.     "northwest"
  684.     incase D_UP:
  685.     "up"
  686.     incase D_DOWN:
  687.     "down"
  688.     incase D_ENTER:
  689.     "in"
  690.     incase D_EXIT:
  691.     "out"
  692.     default:
  693.     ""
  694.     esac
  695. corp;
  696.  
  697. define t_base proc utility public DirProp(int dir)property thing:
  698.     case dir
  699.     incase D_NORTH:
  700.     p_rNorth
  701.     incase D_NORTHEAST:
  702.     p_rNorthEast
  703.     incase D_EAST:
  704.     p_rEast
  705.     incase D_SOUTHEAST:
  706.     p_rSouthEast
  707.     incase D_SOUTH:
  708.     p_rSouth
  709.     incase D_SOUTHWEST:
  710.     p_rSouthWest
  711.     incase D_WEST:
  712.     p_rWest
  713.     incase D_NORTHWEST:
  714.     p_rNorthWest
  715.     incase D_UP:
  716.     p_rUp
  717.     incase D_DOWN:
  718.     p_rDown
  719.     incase D_ENTER:
  720.     p_rEnter
  721.     incase D_EXIT:
  722.     p_rExit
  723.     default:
  724.     Print("*** invalid direction number ");
  725.     IPrint(dir);
  726.     Print(" to 'DirProp' ***\n");
  727.     p_rNorth
  728.     esac
  729. corp;
  730.  
  731. define t_base proc utility DirChecks(int dir)property list action:
  732.     case dir
  733.     incase D_NORTH:
  734.     p_rNorthChecks
  735.     incase D_NORTHEAST:
  736.     p_rNorthEastChecks
  737.     incase D_EAST:
  738.     p_rEastChecks
  739.     incase D_SOUTHEAST:
  740.     p_rSouthEastChecks
  741.     incase D_SOUTH:
  742.     p_rSouthChecks
  743.     incase D_SOUTHWEST:
  744.     p_rSouthWestChecks
  745.     incase D_WEST:
  746.     p_rWestChecks
  747.     incase D_NORTHWEST:
  748.     p_rNorthWestChecks
  749.     incase D_UP:
  750.     p_rUpChecks
  751.     incase D_DOWN:
  752.     p_rDownChecks
  753.     incase D_ENTER:
  754.     p_rEnterChecks
  755.     incase D_EXIT:
  756.     p_rExitChecks
  757.     default:
  758.     Print("*** invalid direction number ");
  759.     IPrint(dir);
  760.     Print(" to 'DirChecks' ***\n");
  761.     p_rNorthChecks
  762.     esac
  763. corp;
  764.  
  765. define t_base proc utility public DirDesc(int dir)property string:
  766.     case dir
  767.     incase D_NORTH:
  768.     p_rNorthDesc
  769.     incase D_NORTHEAST:
  770.     p_rNorthEastDesc
  771.     incase D_EAST:
  772.     p_rEastDesc
  773.     incase D_SOUTHEAST:
  774.     p_rSouthEastDesc
  775.     incase D_SOUTH:
  776.     p_rSouthDesc
  777.     incase D_SOUTHWEST:
  778.     p_rSouthWestDesc
  779.     incase D_WEST:
  780.     p_rWestDesc
  781.     incase D_NORTHWEST:
  782.     p_rNorthWestDesc
  783.     incase D_UP:
  784.     p_rUpDesc
  785.     incase D_DOWN:
  786.     p_rDownDesc
  787.     incase D_ENTER:
  788.     p_rEnterDesc
  789.     incase D_EXIT:
  790.     p_rExitDesc
  791.     default:
  792.     Print("*** invalid direction number ");
  793.     IPrint(dir);
  794.     Print(" to 'DirDesc' ***\n");
  795.     p_rNorthDesc
  796.     esac
  797. corp;
  798.  
  799. define t_base proc utility public DirMessage(int dir)property string:
  800.     case dir
  801.     incase D_NORTH:
  802.     p_rNorthMessage
  803.     incase D_NORTHEAST:
  804.     p_rNorthEastMessage
  805.     incase D_EAST:
  806.     p_rEastMessage
  807.     incase D_SOUTHEAST:
  808.     p_rSouthEastMessage
  809.     incase D_SOUTH:
  810.     p_rSouthMessage
  811.     incase D_SOUTHWEST:
  812.     p_rSouthWestMessage
  813.     incase D_WEST:
  814.     p_rWestMessage
  815.     incase D_NORTHWEST:
  816.     p_rNorthWestMessage
  817.     incase D_UP:
  818.     p_rUpMessage
  819.     incase D_DOWN:
  820.     p_rDownMessage
  821.     incase D_ENTER:
  822.     p_rEnterMessage
  823.     incase D_EXIT:
  824.     p_rExitMessage
  825.     default:
  826.     Print("*** invalid direction number ");
  827.     IPrint(dir);
  828.     Print(" to 'DirMessage' ***\n");
  829.     p_rNorthMessage
  830.     esac
  831. corp;
  832.  
  833. define t_base proc utility public DirOMessage(int dir)property string:
  834.     case dir
  835.     incase D_NORTH:
  836.     p_rNorthOMessage
  837.     incase D_NORTHEAST:
  838.     p_rNorthEastOMessage
  839.     incase D_EAST:
  840.     p_rEastOMessage
  841.     incase D_SOUTHEAST:
  842.     p_rSouthEastOMessage
  843.     incase D_SOUTH:
  844.     p_rSouthOMessage
  845.     incase D_SOUTHWEST:
  846.     p_rSouthWestOMessage
  847.     incase D_WEST:
  848.     p_rWestOMessage
  849.     incase D_NORTHWEST:
  850.     p_rNorthWestOMessage
  851.     incase D_UP:
  852.     p_rUpOMessage
  853.     incase D_DOWN:
  854.     p_rDownOMessage
  855.     incase D_ENTER:
  856.     p_rEnterOMessage
  857.     incase D_EXIT:
  858.     p_rExitOMessage
  859.     default:
  860.     Print("*** invalid direction number ");
  861.     IPrint(dir);
  862.     Print(" to 'DirOMessage' ***\n");
  863.     p_rNorthOMessage
  864.     esac
  865. corp;
  866.  
  867. define t_base proc utility public DirEMessage(int dir)property string:
  868.     case dir
  869.     incase D_NORTH:
  870.     p_rNorthEMessage
  871.     incase D_NORTHEAST:
  872.     p_rNorthEastEMessage
  873.     incase D_EAST:
  874.     p_rEastEMessage
  875.     incase D_SOUTHEAST:
  876.     p_rSouthEastEMessage
  877.     incase D_SOUTH:
  878.     p_rSouthEMessage
  879.     incase D_SOUTHWEST:
  880.     p_rSouthWestEMessage
  881.     incase D_WEST:
  882.     p_rWestEMessage
  883.     incase D_NORTHWEST:
  884.     p_rNorthWestEMessage
  885.     incase D_UP:
  886.     p_rUpEMessage
  887.     incase D_DOWN:
  888.     p_rDownEMessage
  889.     incase D_ENTER:
  890.     p_rEnterEMessage
  891.     incase D_EXIT:
  892.     p_rExitEMessage
  893.     default:
  894.     Print("*** invalid direction number ");
  895.     IPrint(dir);
  896.     Print(" to 'DirEMessage' ***\n");
  897.     p_rNorthEMessage
  898.     esac
  899. corp;
  900.  
  901. /*
  902.  * DirMatch - turn a string into a direction number. Return -1 if the string
  903.  *    is not a valid direction name.
  904.  */
  905.  
  906. define t_base proc utility public DirMatch(string name)int:
  907.  
  908.     MatchName(
  909.     "north,n.northeast,north-east,ne.east,e.southeast,south-east,se."
  910.     "south,s.southwest,south-west,sw.west,w.northwest,north-west,nw."
  911.     "up,u.down,d.enter,in,inside.exit,out,outside,leave", name)
  912. corp;
  913.  
  914. /*
  915.  * PairToDir - decode a character pair to a direction number.
  916.  */
  917.  
  918. define t_base proc utility public PairToDir(string ch)int:
  919.  
  920.     if ch == "n " then
  921.     D_NORTH
  922.     elif ch == "ne" then
  923.     D_NORTHEAST
  924.     elif ch == "e " then
  925.     D_EAST
  926.     elif ch == "se" then
  927.     D_SOUTHEAST
  928.     elif ch == "s " then
  929.     D_SOUTH
  930.     elif ch == "sw" then
  931.     D_SOUTHWEST
  932.     elif ch == "w " then
  933.     D_WEST
  934.     elif ch == "nw" then
  935.     D_NORTHWEST
  936.     elif ch == "u " then
  937.     D_UP
  938.     elif ch == "d " then
  939.     D_DOWN
  940.     elif ch == "in" then
  941.     D_ENTER
  942.     elif ch == "ex" then
  943.     D_EXIT
  944.     else
  945.     -1
  946.     fi
  947. corp;
  948.  
  949. /*
  950.  * AddChecker - utility for adding checkers to checker lists.
  951.  */
  952.  
  953. define tp_base proc utility AddChecker(thing th; property list action pla;
  954.                        action a; bool front)void:
  955.     list action la;
  956.  
  957.     la := th@pla;
  958.     if la = nil then
  959.     /* there was no list yet - create one */
  960.     la := CreateActionList();
  961.     th@pla := la;
  962.     AddTail(la, a);
  963.     else
  964.     if front then
  965.         AddHead(la, a);
  966.     else
  967.         AddTail(la, a);
  968.     fi;
  969.     fi;
  970. corp;
  971.  
  972. /*
  973.  * delChecker - utility for deleting checkers and removing the list if
  974.  *    it is now empty.
  975.  */
  976.  
  977. define tp_base proc utility delChecker(thing th; property list action pla;
  978.                        action a)void:
  979.     list action la;
  980.  
  981.     la := th@pla;
  982.     if la ~= nil then
  983.     DelElement(la, a);
  984.     if Count(la) = 0 then
  985.         th -- pla;
  986.     fi;
  987.     fi;
  988. corp;
  989.  
  990. /* Routines for adding direction checkers. Note that there could easily be
  991.    routines to delete the checkers, but I don't believe there should be any
  992.    checkers on rooms that need to be deleted. The checker can check some
  993.    state somewhere to make its effects conditional. It is NOT a good idea
  994.    to have to modify and write out rooms as people wander through them.
  995.    Later: people want them via the build facilites, so I've added them. */
  996.  
  997. define t_base proc utility AddNorthChecker(thing room; action a;
  998.     bool front)void:
  999.     AddChecker(room, p_rNorthChecks, a, front);
  1000. corp;
  1001.  
  1002. define t_base proc utility DelNorthChecker(thing room; action a)void:
  1003.     delChecker(room, p_rNorthChecks, a);
  1004. corp;
  1005.  
  1006. define t_base proc utility AddSouthChecker(thing room; action a;
  1007.     bool front)void:
  1008.     AddChecker(room, p_rSouthChecks, a, front);
  1009. corp;
  1010.  
  1011. define t_base proc utility DelSouthChecker(thing room; action a)void:
  1012.     delChecker(room, p_rSouthChecks, a);
  1013. corp;
  1014.  
  1015. define t_base proc utility AddEastChecker(thing room; action a;
  1016.     bool front)void:
  1017.     AddChecker(room, p_rEastChecks, a, front);
  1018. corp;
  1019.  
  1020. define t_base proc utility DelEastChecker(thing room; action a)void:
  1021.     delChecker(room, p_rEastChecks, a);
  1022. corp;
  1023.  
  1024. define t_base proc utility AddWestChecker(thing room; action a;
  1025.     bool front)void:
  1026.     AddChecker(room, p_rWestChecks, a, front);
  1027. corp;
  1028.  
  1029. define t_base proc utility DelWestChecker(thing room; action a)void:
  1030.     delChecker(room, p_rWestChecks, a);
  1031. corp;
  1032.  
  1033. define t_base proc utility AddNorthEastChecker(thing room; action a;
  1034.     bool front)void:
  1035.     AddChecker(room, p_rNorthEastChecks, a, front);
  1036. corp;
  1037.  
  1038. define t_base proc utility DelNorthEastChecker(thing room; action a)void:
  1039.     delChecker(room, p_rNorthEastChecks, a);
  1040. corp;
  1041.  
  1042. define t_base proc utility AddNorthWestChecker(thing room; action a;
  1043.     bool front)void:
  1044.     AddChecker(room, p_rNorthWestChecks, a, front);
  1045. corp;
  1046.  
  1047. define t_base proc utility DelNorthWestChecker(thing room; action a)void:
  1048.     delChecker(room, p_rNorthWestChecks, a);
  1049. corp;
  1050.  
  1051. define t_base proc utility AddSouthEastChecker(thing room; action a;
  1052.     bool front)void:
  1053.     AddChecker(room, p_rSouthEastChecks, a, front);
  1054. corp;
  1055.  
  1056. define t_base proc utility DelSouthEastChecker(thing room; action a)void:
  1057.     delChecker(room, p_rSouthEastChecks, a);
  1058. corp;
  1059.  
  1060. define t_base proc utility AddSouthWestChecker(thing room; action a;
  1061.     bool front)void:
  1062.     AddChecker(room, p_rSouthWestChecks, a, front);
  1063. corp;
  1064.  
  1065. define t_base proc utility DelSouthWestChecker(thing room; action a)void:
  1066.     delChecker(room, p_rSouthWestChecks, a);
  1067. corp;
  1068.  
  1069. define t_base proc utility AddUpChecker(thing room; action a; bool front)void:
  1070.     AddChecker(room, p_rUpChecks, a, front);
  1071. corp;
  1072.  
  1073. define t_base proc utility DelUpChecker(thing room; action a)void:
  1074.     delChecker(room, p_rUpChecks, a);
  1075. corp;
  1076.  
  1077. define t_base proc utility AddDownChecker(thing room; action a;bool front)void:
  1078.     AddChecker(room, p_rDownChecks, a, front);
  1079. corp;
  1080.  
  1081. define t_base proc utility DelDownChecker(thing room; action a)void:
  1082.     delChecker(room, p_rDownChecks, a);
  1083. corp;
  1084.  
  1085. define t_base proc utility AddEnterChecker(thing room; action a;
  1086.     bool front)void:
  1087.     AddChecker(room, p_rEnterChecks, a, front);
  1088. corp;
  1089.  
  1090. define t_base proc utility DelEnterChecker(thing room; action a)void:
  1091.     delChecker(room, p_rEnterChecks, a);
  1092. corp;
  1093.  
  1094. define t_base proc utility AddExitChecker(thing room; action a;bool front)void:
  1095.     AddChecker(room, p_rExitChecks, a, front);
  1096. corp;
  1097.  
  1098. define t_base proc utility DelExitChecker(thing room; action a)void:
  1099.     delChecker(room, p_rExitChecks, a);
  1100. corp;
  1101.  
  1102. define t_base proc utility AddDirChecker(thing room; int dir; action a;
  1103.     bool front)void:
  1104.     AddChecker(room, DirChecks(dir), a, false);
  1105. corp;
  1106.  
  1107. define t_base proc utility DelDirChecker(thing room; int dir; action a)void:
  1108.     delChecker(room, DirChecks(dir), a);
  1109. corp;
  1110.  
  1111. /* routines for inserting checkers in rooms for specific verbs */
  1112.  
  1113. define t_base proc utility AddAnyEnterChecker(thing room; action a;
  1114.     bool front)void:
  1115.     AddChecker(room, p_rAnyEnterChecks, a, front);
  1116. corp;
  1117.  
  1118. define t_base proc utility DelAnyEnterChecker(thing room; action a)void:
  1119.     delChecker(room, p_rAnyEnterChecks, a);
  1120. corp;
  1121.  
  1122. define t_base proc utility AddAnyEnterAction(thing room; action a;
  1123.     bool front)void:
  1124.     AddChecker(room, p_rAnyEnterActions, a, front);
  1125. corp;
  1126.  
  1127. define t_base proc utility DelAnyEnterAction(thing room; action a)void:
  1128.     delChecker(room, p_rAnyEnterActions, a);
  1129. corp;
  1130.  
  1131. define t_base proc utility AddAnyLeaveChecker(thing room; action a;
  1132.     bool front)void:
  1133.     AddChecker(room, p_rAnyLeaveChecks, a, front);
  1134. corp;
  1135.  
  1136. define t_base proc utility DelAnyLeaveChecker(thing room; action a)void:
  1137.     delChecker(room, p_rAnyLeaveChecks, a);
  1138. corp;
  1139.  
  1140. define t_base proc utility AddAnyLeaveAction(thing room; action a;
  1141.     bool front)void:
  1142.     AddChecker(room, p_rAnyLeaveActions, a, front);
  1143. corp;
  1144.  
  1145. define t_base proc utility DelAnyLeaveAction(thing room; action a)void:
  1146.     delChecker(room, p_rAnyLeaveActions, a);
  1147. corp;
  1148.  
  1149. define t_base proc utility AddRoomGetChecker(thing room; action a;
  1150.     bool front)void:
  1151.     AddChecker(room, p_rGetChecks, a, front);
  1152. corp;
  1153.  
  1154. define t_base proc utility DelRoomGetChecker(thing room; action a)void:
  1155.     delChecker(room, p_rGetChecks, a);
  1156. corp;
  1157.  
  1158. define t_base proc utility AddRoomDropChecker(thing room; action a;
  1159.     bool front)void:
  1160.     AddChecker(room, p_rDropChecks, a, front);
  1161. corp;
  1162.  
  1163. define t_base proc utility DelRoomDropChecker(thing room; action a)void:
  1164.     delChecker(room, p_rDropChecks, a);
  1165. corp;
  1166.  
  1167. define t_base proc utility AddRoomSayChecker(thing room; action a;
  1168.     bool front)void:
  1169.     AddChecker(room, p_rSayChecks, a, front);
  1170. corp;
  1171.  
  1172. define t_base proc utility DelRoomSayChecker(thing room; action a)void:
  1173.     delChecker(room, p_rSayChecks, a);
  1174. corp;
  1175.  
  1176. define t_base proc utility AddRoomLookChecker(thing room; action a;
  1177.     bool front)void:
  1178.     AddChecker(room, p_rLookChecks, a, front);
  1179. corp;
  1180.  
  1181. define t_base proc utility DelRoomLookChecker(thing room; action a)void:
  1182.     delChecker(room, p_rLookChecks, a);
  1183. corp;
  1184.  
  1185. /* routines to add/delete checkers on players */
  1186.  
  1187. define t_base proc utility AddPlayerEnterChecker(thing player;
  1188.     action a; bool front)void:
  1189.     AddChecker(player, p_pEnterChecks, a, front);
  1190. corp;
  1191.  
  1192. define t_base proc utility DelPlayerEnterChecker(thing player; action a)void:
  1193.     delChecker(player, p_pEnterChecks, a);
  1194. corp;
  1195.  
  1196. define t_base proc utility AddPlayerLeaveChecker(thing player;
  1197.     action a; bool front)void:
  1198.     AddChecker(player, p_pLeaveChecks, a, front);
  1199. corp;
  1200.  
  1201. define t_base proc utility DelPlayerLeaveChecker(thing player; action a)void:
  1202.     delChecker(player, p_pLeaveChecks, a);
  1203. corp;
  1204.  
  1205. /* Some routines to actually do some special room checks. These are here
  1206.    so that the properties holding the checkers can be private */
  1207.  
  1208. define t_base proc utility DoDirChecks(thing room; int dir)status:
  1209.     DoChecks(room@DirChecks(dir))
  1210. corp;
  1211.  
  1212. define t_base proc utility DoRoomAnyEnterChecks(thing room)status:
  1213.     DoChecks(room@p_rAnyEnterChecks)
  1214. corp;
  1215.  
  1216. define t_base proc utility DoRoomAnyEnterActions(thing dest)void:
  1217.     DoThingActions(dest@p_rAnyEnterActions, dest);
  1218. corp;
  1219.  
  1220. define t_base proc utility DoRoomAnyLeaveChecks(thing room)status:
  1221.     DoChecks(room@p_rAnyLeaveChecks)
  1222. corp;
  1223.  
  1224. define t_base proc utility DoRoomAnyLeaveActions(thing here, dest)void:
  1225.     DoThingActions(here@p_rAnyLeaveActions, dest);
  1226. corp;
  1227.  
  1228. define t_base proc utility DoRoomSayChecks(thing room; string said)status:
  1229.     DoStringChecks(room@p_rSayChecks, said)
  1230. corp;
  1231.  
  1232. define t_base proc utility DoRoomLookChecks(thing room)status:
  1233.     DoChecks(room@p_rLookChecks)
  1234. corp;
  1235.  
  1236. define t_base proc utility DoRoomGetChecks(thing room, object)status:
  1237.     DoThingChecks(room@p_rGetChecks, object)
  1238. corp;
  1239.  
  1240. define t_base proc utility DoRoomDropChecks(thing room, object)status:
  1241.     DoThingChecks(room@p_rDropChecks, object)
  1242. corp;
  1243.  
  1244. /* routines to do some of the private player checks */
  1245.  
  1246. define t_base proc utility DoPlayerLeaveChecks(thing who; int dir)status:
  1247.     DoIntChecks(who@p_pLeaveChecks, dir)
  1248. corp;
  1249.  
  1250. define t_base proc utility DoPlayerEnterChecks(thing who)status:
  1251.     DoChecks(who@p_pEnterChecks)
  1252. corp;
  1253.  
  1254. /* This is used to allow creation of a carrying list on machines - it does
  1255.    it carefully. */
  1256.  
  1257. define t_base proc utility public SetupMachine(thing machine)void:
  1258.  
  1259.     if machine@p_pCarrying = nil then
  1260.     machine@p_pCarrying := CreateThingList();
  1261.     fi;
  1262.     if machine@p_pHiddenList = nil then
  1263.     machine@p_pHiddenList := CreateThingList();
  1264.     fi;
  1265. corp;
  1266.  
  1267. unuse tp_base
  1268.